'##############
'Двери пассажирские- Скрипт
'##############
'
'Управляет дверями автобуса

'(c) 2007-2009 Rьdiger Hьlsmann
'(c) 2007-2009 Marcel Kuhnt

'Script Version: 1.1
'Omsi release: 1.0

'Needs:
'- elec

'Revision History:
'- Marcel Kuhnt		13.06.2009	Batterietrennschalter => elec_busbar_main
'- Marcel Kuhnt		21.06.2009	AI-Unterstьtzung hinzugefьgt	
'- Rьdiger Hьlsmann	24.10.2009	Ansteuerung des Kinderwagenwunsches modifiziert
'- Rьdiger Hьlsmann	19.12.2009	Timer fьr Ausstiegstьr jetzt Timegap-basiert, Bugfix: Tьr schlieЯt jetzt nur bei elec_busbar=1
'- RЬdiger Hьlsmann	22.09.2010	Door light trigger value set to 0.1
'- RЬdiger Hьlsmann	07.11.2010	Door speed based on reservoir pressure, air-operated doors made an option
'- Marcel Kuhnt		08.11.2010	AI procedure closing doors debugged
'- Rьdiger Hьlsmann	21.11.2010	Front doors only operable when busbar on
'- Rьdiger Hьlsmann	23.12.2010	External front door operation included, option: doors only operable with actual stop brake
'- Rьdiger Hьlsmann	31.12.2010	Electric door function debugged
'- Rьdiger Hьlsmann	05.01.2011	20h-switch
'- Rьdiger Hьlsmann	07.01.2011	Backdoor manual switch sound debugged, 20h switch depending on bus type
'- Rьdiger Hьlsmann	19.01.2011	Electric door support
'- Яковлев Вячеслав 18.12.2011	Исправлены триггеры кнопок открывания дверей, вход-выход пассажиров
'- Яковлев Вячеслав 28.12.2011	Скрипт просчета движения створок теперь для каждой створки свой, скорость дверей теперь
'-								настраивается в constfile

'--------------------------------------------------------------------------------

{trigger:bus_door_0}
	(L.L.door_0) 0.2 <
	{if}
		(M.L.trg_bus_door_0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_door_0_open)
{end}

{trigger:bus_door_0_off}
 	0 (S.L.cockpit_door_0_open)
{end}
'--------------------------------------
{trigger:bus_door_0_close}
	(L.L.door_0) 0.8 >
	{if}
		(M.L.trg_bus_door_0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_door_0_close)
{end}

{trigger:bus_door_0_close_off}
 	0 (S.L.cockpit_door_0_close)
{end}
'---------------------------------------------------
{trigger:bus_door_1}
	(L.L.door_1) 0.2 <
	{if}
		(M.L.trg_bus_door_1)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_door_1_open)
{end}

{trigger:bus_door_1_off}
 	0 (S.L.cockpit_door_1_open)
{end}
'--------------------------------------
{trigger:bus_door_1_close}
	(L.L.door_1) 0.8 >
	{if}
		(M.L.trg_bus_door_1)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_door_1_close)
{end}

{trigger:bus_door_1_close_off}
 	0 (S.L.cockpit_door_1_close)
{end}
'------------------------------------------------------
{trigger:bus_door_2}
	(L.L.door_2L) 0.2 <
	(L.L.door_2R) 0.2 < &&
	{if}
		(M.L.trg_bus_doorfront0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_tuertaster1)
{end}

{trigger:bus_door_2_off}
	0 (S.L.cockpit_tuertaster1)
{end}
'--------------------------------------
{trigger:bus_door_2_close}
	(L.L.door_2L) 0.8 >
	(L.L.door_2R) 0.8 > &&
	{if}
		(M.L.trg_bus_doorfront0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.cockpit_door_2_close)
{end}

{trigger:bus_door_2_close_off}
 	0 (S.L.cockpit_door_2_close)
{end}

'-------------------------------------------------------
'	Наружние кнопки открывания дверей
'-------------------------------------------------------

{trigger:kuzov_bt_door_1}
	(L.L.door_0) 0.2 <
	(L.L.door_1) 0.2 <
	{if}
		(M.L.trg_bus_door_1)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.kuzov_bt_door_1)
{end}

{trigger:kuzov_bt_door_1_off}
 	0 (S.L.kuzov_bt_door_1)
{end}

'------------------------------------------------------
{trigger:kuzov_bt_door_2}
	(L.L.door_2L) 0.2 <
	(L.L.door_2R) 0.2 < &&
	{if}
		(M.L.trg_bus_doorfront0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.kuzov_bt_door_2)
{end}

{trigger:kuzov_bt_door_2_off}
	0 (S.L.kuzov_bt_door_2)
{end}

'-------------------------------------------------------
'	Внутренние кнопки открывания дверей
'-------------------------------------------------------

{trigger:interior_bt_door_1}
	(L.L.door_0) 0.2 <
	(L.L.door_1) 0.2 <
	{if}
		(M.L.trg_bus_door_1)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.interior_bt_door_1)
{end}

{trigger:interior_bt_door_1_off}
 	0 (S.L.interior_bt_door_1)
{end}

'------------------------------------------------------
{trigger:interior_bt_door_2}
	(L.L.door_2L) 0.2 <
	(L.L.door_2R) 0.2 < &&
	{if}
		(M.L.trg_bus_doorfront0)
	{endif}
	(T.L.ev_kippschalter_aus)
	1 (S.L.interior_bt_door_2)
{end}

{trigger:interior_bt_door_2_off}
	0 (S.L.interior_bt_door_2)
{end}

'-------------------------------------------------------
'	Триггеры для управления дверьми с клавиатуры
'-------------------------------------------------------
'	Первая дверь
{trigger:bus_doorfront0}
	(M.L.trg_bus_door_1)
	(T.L.ev_kippschalter_aus)
	(L.L.door_1) 0.5 <
	{if}
		1 (S.L.cockpit_door_1_open)
	{else}
		1 (S.L.cockpit_door_1_close)
	{endif}
{end}

{trigger:bus_doorfront0_off}
 	0 (S.L.cockpit_door_1_open) (S.L.cockpit_door_1_close)
{end}

'	Средняя дверь
{trigger:bus_doorfront1}
	(M.L.trg_bus_doorfront0)
	(T.L.ev_kippschalter_aus)
	(L.L.door_2L) 0.5 <
	(L.L.door_2R) 0.5 < &&
	{if}
		1 (S.L.cockpit_tuertaster1)
	{else}
		1 (S.L.cockpit_door_2_close)
	{endif}
{end}

{trigger:bus_doorfront1_off}
	0 (S.L.cockpit_tuertaster1) (S.L.cockpit_door_2_close)
{end}

{trigger:bus_dooraft_off}
	0 (S.L.cockpit_tuertaster2) (S.L.cockpit_door_3_close)
{end}

'---------------------------------------
{trigger:int_haltewunsch}
	1 (S.L.haltewunsch)
{end}

{trigger:door_haltewunsch}
	1 (S.L.haltewunsch) (S.L.door_haltewunsch_knopfdruck)
	(T.L.ev_kippschalter_aus)
	(T.L.ev_haltebremse_sound)
{end}

{trigger:door_haltewunsch_off}
	0 (S.L.door_haltewunsch_knopfdruck)
{end}





{macro:Door_Init}
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.fdoor_acc) + (S.L.doorAcc_0)
	1000 random 500 / 1 - (C.L.door_acc_var) * (C.L.fdoor_acc) + (S.L.doorAcc_1)
	1000 random 500 / 1 - (C.L.door_acc_var2L) * (C.L.fdoor_acc2L) + (S.L.doorAcc_2L)
	1000 random 500 / 1 - (C.L.door_acc_var2R) * (C.L.fdoor_acc2R) + (S.L.doorAcc_2R)
	1000 random 500 / 1 - (C.L.door_acc_var3L) * (C.L.fdoor_acc3L) + (S.L.doorAcc_3L)
	1000 random 500 / 1 - (C.L.door_acc_var3R) * (C.L.fdoor_acc3R) + (S.L.doorAcc_3R)
	

	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.fdoor_maxspeed) + (S.L.doorMaxSpeed_0)
	1000 random 500 / 1 - (C.L.door_maxspeed_var) * (C.L.fdoor_maxspeed) + (S.L.doorMaxSpeed_1)
	1000 random 500 / 1 - (C.L.door_maxspeed_var2L) * (C.L.fdoor_maxspeed2L) + (S.L.doorMaxSpeed_2L)
	1000 random 500 / 1 - (C.L.door_maxspeed_var2R) * (C.L.fdoor_maxspeed2R) + (S.L.doorMaxSpeed_2R)

	(C.L.door_refl) (S.L.doorRefl_0)
	(C.L.door_refl) (S.L.doorRefl_1)
	(C.L.door_refl2L) (S.L.doorRefl_2L)
	(C.L.door_refl2R) (S.L.doorRefl_2R)
	
{end}

{macro:Door_Frame}
	(M.L.Door0_Calc)
	(M.L.Door1_Calc)
	(M.L.Door2_Calc)
	

	(L.L.door_0) 0.9 > (S.L.PAX_Entry3_Open) (S.L.PAX_Exit3_Open)
	(L.L.door_1) 0.9 > (S.L.PAX_Entry0_Open) (S.L.PAX_Exit0_Open)
	(L.L.door_2L) 0.9 > (S.L.PAX_Entry1_Open) (S.L.PAX_Exit1_Open)

'	Haltewunschlampe:
	(L.L.haltewunsch) 
	(L.L.door_2R) 0.2 < &&
	(L.L.door_2L) 0.2 <	&&
	(L.L.door_1) 0.2 < &&
	(L.L.elec_busbar_main) &&
	{if}
		1 (S.L.haltewunschlampe)
	{else}
		0 (S.L.haltewunschlampe) (S.L.haltewunsch)
	{endif}

		(L.L.door_1) 0 =  !  
		(L.L.door_2L) 0 =  ! && 		
		(L.L.elec_busbar_main) && 		
        (S.L.door_open_light_all)
	
	(L.L.door_2L) 0 = ! 
	(L.L.elec_busbar_main) &&
	{if}		
		(S.L.door_open_light_all)
	{endif}

	(L.L.door_1) 0 = ! 
	(L.L.elec_busbar_main) &&
	{if}		
		(S.L.door_open_light_all)
	{endif}

	(L.L.door_2L) 0 = 
	(L.L.door_1) 0 = &&
	(L.L.elec_busbar_main) &&
	{if}		
		0 (S.L.door_open_light_all)
	{endif}	
	
'---------------------------------------
'Звук требования остановки
'---------------------------------------
	(L.L.haltewunschlampe) !
	{if}
		1 (S.L.haltebremse_sound_ctrl)
	{endif}

	(L.L.haltewunschlampe)
	(L.L.haltebremse_sound_ctrl) &&
	{if}
		(T.L.ev_haltebremse_sound)
		0 (S.L.haltebremse_sound_ctrl)
	{endif} 
'---------------------------------------

'	Abfall des Kinderwagenwunsch-Relais bei fehlender Stromversorgung:

	(L.L.elec_busbar_main) 0 = 
	{if}
		0 (S.L.door_kinderwagenwunsch)
	{endif}

	
	
'----------------------------------
'Doors: \\ Двери

	(L.L.AI_Scheduled_AtStation) s0
	1 =
	{if}
'Wenn Tьren geцffnet werden sollen:
		(L.L.Velocity) (C.L.Door_Bremse_Halte_MaxKMH) <
		{if}
'Nur, wenn v < maxkmh, sonst warten
'Taster jeweils nur betдtigen, falls noch nicht an

			(L.L.doorTarget_0) ! 
			(L.L.door_AI_timer) 0.3 > &&
			{if}
				(M.L.trg_bus_door_0)
			{endif}

			(L.L.doorTarget_1) ! 
			(L.L.door_AI_timer) 0.3 > &&
			{if}
				(M.L.trg_bus_door_1)
			{endif}

			(L.L.doorTarget_2L) ! 
			(L.L.door_AI_timer) 0.3 > &&
			{if}
				(M.L.trg_bus_doorfront0)
			{endif}
		{else}
			0 (S.L.door_AI_timer)
		{endif}
		(L.L.door_AI_timer) (L.S.Timegap) + (S.L.door_AI_timer)
	{else}
		l0 -1 =
		{if}
'Wenn Tьren geschlossen werden sollen:
'Taster jeweils nur betдtigen, falls noch nicht aus:

			(L.L.doorTarget_0)
			{if}
				(M.L.trg_bus_door_0)
				0 (S.L.door_AI_timer)
			{endif}


			(L.L.doorTarget_1)
			{if}
				(M.L.trg_bus_door_1)
				0 (S.L.door_AI_timer)
			{endif}


			(L.L.doorTarget_2L)
			{if}
				(M.L.trg_bus_doorfront0)
				0 (S.L.door_AI_timer)
			{endif}
		
'Haltestellenbremse erst wegnehmen, wenn alle Tьren zu. Dann auch erst den Bus AI-mдЯig freigeben:
			(L.L.door_0) 0.1 <
			(L.L.door_1) 0.1 < &&
			(L.L.door_2L) 0.1 < &&
			(L.L.door_2R) 0.1 < &&
			{if}
				0 (S.L.AI_Scheduled_AtStation)
			{else}
				(L.L.doorTarget_0) !
				(L.L.doorTarget_1) ! &&
				(L.L.doorTarget_2L) ! &&
				(L.L.doorTarget_2R) ! &&
				{if}
					0 (S.L.door_AI_timer)
				{endif}
			{endif}
			(L.L.door_AI_timer) (L.S.Timegap) + (S.L.door_AI_timer)
		{endif}
	{endif}

	
{end}

'-------------------------------------------------------
{macro:Door0_Calc}

	(L.L.doorTarget_0)
	{if}
		(L.L.door_0) (F.L.door_0_opn_speed) (S.L.doorMaxSpeed_0)
	{else}
		(L.L.door_0) (F.L.door_0_cls_speed) (S.L.doorMaxSpeed_0)
	{endif}
	
	(C.L.fdoor_acc) (S.L.doorAcc_0)
	
	(L.L.doorTarget_0) ! (L.L.doorSpeed_0) s0 abs 0.05 > (L.L.door_0) 0 > || && 
	{if}
		l0 /-/ (L.L.doorMaxSpeed_0) <
		{if}
			(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * - (S.L.doorSpeed_0)
		{else}
			(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * + (S.L.doorSpeed_0)
		{endif}
		(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
	{else}
		(L.L.doorSpeed_0) abs 0.05 > (L.L.door_0) 1 < || (L.L.doorTarget_0) &&
		{if}
			l0 (L.L.doorMaxSpeed_0) <
			{if}
				(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * + (S.L.doorSpeed_0) 
			{else}
				(L.L.doorSpeed_0) (L.L.doorAcc_0) (L.S.Timegap) * - (S.L.doorSpeed_0) 
			{endif}
			(L.L.door_0) (L.L.doorSpeed_0) (L.S.Timegap) * + (S.L.door_0)
		{else}
			0 (S.L.doorSpeed_0)
		{endif}
	{endif}

	(L.L.door_0) 1 >
	{if}
		(T.L.ev_door_open_stuk_0)
		1 (S.L.door_0)
		(L.L.doorSpeed_0) /-/ (L.L.doorRefl_0) * (S.L.doorSpeed_0)
	{else}
		(L.L.door_0) 0 <
		{if}
			(T.L.ev_door_close_stuk_0)
			0 (S.L.door_0)
			(L.L.doorSpeed_0) /-/ (L.L.doorRefl_0) * (S.L.doorSpeed_0)
		{endif}
	{endif}

	(L.L.door_0) 0 = !
	(L.L.elec_busbar_main) &&
	(S.L.door_open_light_0)
{end}

{macro:trg_bus_door_0}

	(L.L.doorTarget_0) ! (S.L.doorTarget_0) 
		{if}
			(T.L.ev_door_open_0)
		{else}
			(T.L.ev_door_close_0)
		{endif}	
		(L.L.bremse_p_Tank04) 100000 - 0.99 * 100000 + (S.L.bremse_p_Tank04)
{end}


'-------------------------------------------------------

{macro:Door1_Calc}

	(L.L.doorTarget_1)
	{if}
		(L.L.door_1) (F.L.door_1_opn_speed) (S.L.doorMaxSpeed_1)
	{else}
		(L.L.door_1) (F.L.door_1_cls_speed) (S.L.doorMaxSpeed_1)
	{endif}
	
	(C.L.fdoor_acc) (S.L.doorAcc_1)
	
	(L.L.doorTarget_1) ! (L.L.doorSpeed_1) s0 abs 0.05 > (L.L.door_1) 0 > || && 
	{if}
		l0 /-/ (L.L.doorMaxSpeed_1) <
		{if}
			(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * - (S.L.doorSpeed_1)
		{else}
			(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * + (S.L.doorSpeed_1)
		{endif}
		(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
	{else}
		(L.L.doorSpeed_1) abs 0.05 > (L.L.door_1) 1 < || (L.L.doorTarget_1) &&
		{if}
			l0 (L.L.doorMaxSpeed_1) <
			{if}
				(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * + (S.L.doorSpeed_1) 
			{else}
				(L.L.doorSpeed_1) (L.L.doorAcc_1) (L.S.Timegap) * - (S.L.doorSpeed_1) 
			{endif}
			(L.L.door_1) (L.L.doorSpeed_1) (L.S.Timegap) * + (S.L.door_1)
		{else}
			0 (S.L.doorSpeed_1)
		{endif}
	{endif}

	(L.L.door_1) 1 >
	{if}
		(T.L.ev_door_open_stuk_1)
		1 (S.L.door_1)
		(L.L.doorSpeed_1) /-/ (L.L.doorRefl_1) * (S.L.doorSpeed_1)
	{else}
		(L.L.door_1) 0 <
		{if}
			(T.L.ev_door_close_stuk_1)
			0 (S.L.door_1)
			(L.L.doorSpeed_1) /-/ (L.L.doorRefl_1) * (S.L.doorSpeed_1)
		{endif}
	{endif}

	(L.L.door_1) 0 = !
	(L.L.elec_busbar_main) &&
	(S.L.door_open_light_1)
	
{end}

{macro:trg_bus_door_1}

	(L.L.doorTarget_1) ! (S.L.doorTarget_1) 
		{if}
			(T.L.ev_door_open_1)
		{else}
			(T.L.ev_door_close_1)
		{endif}	
		(L.L.bremse_p_Tank04) 100000 - 0.99 * 100000 + (S.L.bremse_p_Tank04)
{end}


'-------------------------------------------------------

{macro:Door2_Calc}

'	Левая створка двери

	(L.L.doorTarget_2L)
	{if}
		(L.L.door_2L) (F.L.door_2L_opn_speed) (S.L.doorMaxSpeed_2L)
	{else}
		(L.L.door_2L) (F.L.door_2L_cls_speed) (S.L.doorMaxSpeed_2L)
	{endif}
	
	(C.L.fdoor_acc) (S.L.doorAcc_2L)
	
	(L.L.doorTarget_2L) ! (L.L.doorSpeed_2L) s0 abs 0.05 > (L.L.door_2L) 0 > || && 
	{if}
		l0 /-/ (L.L.doorMaxSpeed_2L) <
		{if}
			(L.L.doorSpeed_2L) (L.L.doorAcc_2L) (L.S.Timegap) * - (S.L.doorSpeed_2L)
		{else}
			(L.L.doorSpeed_2L) (L.L.doorAcc_2L) (L.S.Timegap) * + (S.L.doorSpeed_2L)
		{endif}
		(L.L.door_2L) (L.L.doorSpeed_2L) (L.S.Timegap) * + (S.L.door_2L)
	{else}
		(L.L.doorSpeed_2L) abs 0.05 > (L.L.door_2L) 1 < || (L.L.doorTarget_2L) &&
		{if}
			l0 (L.L.doorMaxSpeed_2L) <
			{if}
				(L.L.doorSpeed_2L) (L.L.doorAcc_2L) (L.S.Timegap) * + (S.L.doorSpeed_2L) 
			{else}
				(L.L.doorSpeed_2L) (L.L.doorAcc_2L) (L.S.Timegap) * - (S.L.doorSpeed_2L) 
			{endif}
			(L.L.door_2L) (L.L.doorSpeed_2L) (L.S.Timegap) * + (S.L.door_2L)
		{else}
			0 (S.L.doorSpeed_2L)
		{endif}
	{endif}

	(L.L.door_2L) 1 >
	{if}
		(T.L.ev_door_open_stuk_2)
		1 (S.L.door_2L)
		(L.L.doorSpeed_2L) /-/ (L.L.doorRefl_2L) * (S.L.doorSpeed_2L)
	{else}
		(L.L.door_2L) 0 <
		{if}
			(T.L.ev_door_close_stuk_2L)
			0 (S.L.door_2L)
			(L.L.doorSpeed_2L) /-/ (L.L.doorRefl_2L) * (S.L.doorSpeed_2L)
		{endif}
	{endif}
	
	
'	Правая створка двери


		(L.L.doorTarget_2R)
		{if}
			(L.L.door_2R) (F.L.door_2R_opn_speed) (S.L.doorMaxSpeed_2R)
		{else}
			(L.L.door_2R) (F.L.door_2R_cls_speed) (S.L.doorMaxSpeed_2R)
		{endif}
	
		(C.L.fdoor_acc) (S.L.doorAcc_2R)
		
		(L.L.doorTarget_2R) ! (L.L.doorSpeed_2R) s0 abs 0.05 > (L.L.door_2R) 0 > || && 
		{if}
			(L.L.door_2L) 0.8 <
			{if}
			l0 /-/ (L.L.doorMaxSpeed_2R) <
			{if}
				(L.L.doorSpeed_2R) (L.L.doorAcc_2R) (L.S.Timegap) * - (S.L.doorSpeed_2R)
			{else}
				(L.L.doorSpeed_2R) (L.L.doorAcc_2R) (L.S.Timegap) * + (S.L.doorSpeed_2R)
			{endif}
			(L.L.door_2R) (L.L.doorSpeed_2R) (L.S.Timegap) * + (S.L.door_2R)
			{endif}
		{else}
			(L.L.doorSpeed_2R) abs 0.05 > (L.L.door_2R) 1 < || (L.L.doorTarget_2R) &&
			{if}
				l0 (L.L.doorMaxSpeed_2R) <
				{if}
					(L.L.doorSpeed_2R) (L.L.doorAcc_2R) (L.S.Timegap) * + (S.L.doorSpeed_2R) 
				{else}
					(L.L.doorSpeed_2R) (L.L.doorAcc_2R) (L.S.Timegap) * - (S.L.doorSpeed_2R) 
				{endif}
				(L.L.door_2R) (L.L.doorSpeed_2R) (L.S.Timegap) * + (S.L.door_2R)
			{else}
				0 (S.L.doorSpeed_2R)
			{endif}
		{endif}

	(L.L.door_2R) 1 >
	{if}
		(T.L.ev_door_open_stuk_2)
		1 (S.L.door_2R)
		(L.L.doorSpeed_2R) /-/ (L.L.doorRefl_2R) * (S.L.doorSpeed_2R)
	{else}
		(L.L.door_2R) 0 <
		{if}
			(T.L.ev_door_close_stuk_2R)
			0 (S.L.door_2R)
			(L.L.doorSpeed_2R) /-/ (L.L.doorRefl_2R) * (S.L.doorSpeed_2R)
		{endif}
	{endif}

	(L.L.door_2L) 0 >
	(L.L.door_2R) 0 > ||
	(L.L.elec_busbar_main) &&
	(S.L.door_open_light_2)
{end}

{macro:trg_bus_doorfront0}
	
		(L.L.doorTarget_2L) ! (S.L.doorTarget_2L)
		(L.L.doorTarget_2R) ! (S.L.doorTarget_2R) && 		
		{if}
			(T.L.ev_door_open_2)
		{else}
			(T.L.ev_door_close_2)
		{endif}
		(L.L.bremse_p_Tank04) 100000 - 0.99 * 100000 + (S.L.bremse_p_Tank04)
{end}

